package com.tianji.learning.controller;


import com.tianji.common.domain.dto.PageDTO;
import com.tianji.learning.domain.dto.NotesDTO;
import com.tianji.learning.domain.query.AdminNotesQuery;
import com.tianji.learning.domain.query.NotesQuery;
import com.tianji.learning.domain.vo.AdminNotesDetailsVO;
import com.tianji.learning.domain.vo.AdminNotesVO;
import com.tianji.learning.domain.vo.NotesVO;
import com.tianji.learning.service.INotesService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 笔记表 前端控制器
 * </p>
 *
 * @author zhongweiwei
 * @since 2023-06-11
 */
@RestController
@RequestMapping("/notes")
@Api("管理端笔记相关接口")
@RequiredArgsConstructor
public class AdminNotesController {
    private final INotesService notesService;


    @GetMapping("/admin")
    @ApiOperation("分页查询笔记接口")
    public PageDTO<AdminNotesVO> adminQueryNote(AdminNotesQuery query) {
        return notesService.adminQueryNote(query);
    }

    @GetMapping("{id}/admin")
    @ApiOperation("查询笔记详情接口")
    public AdminNotesDetailsVO noteDetails(@PathVariable("id") Long id) {
        return notesService.noteDetails(id);

    }

    @PostMapping("{id}/folded")
    @ApiOperation("管理端隐藏笔记接口")
    public void changeNoteStatus(@PathVariable("id") Long id) {
        notesService.changeNoteStatus(id);
    }


}

